package com.yanqu.road.entity.activity.suitang.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.activity.suitang.entity.group.CrossSuiTangGroup;
import com.yanqu.road.entity.activity.suitang.enums.eSuiTangWarType;
import com.yanqu.road.entity.activity.suitang.enums.eSuiTangStage;

import java.sql.Types;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

// 隋唐主数据
@FieldTypeAnnotation(tableName = "t_c_suitang_data")
public class CrossSuiTangData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "商会分组ID", select = true, update = true)
    private int groupId;

    @FieldTypeAnnotation(desc = "当前轮次")
    private AtomicInteger battleRound;

    @FieldTypeAnnotation(desc = "活动阶段")
    private volatile eSuiTangStage step = eSuiTangStage.NoStart;

    @FieldTypeAnnotation(desc = "锁榜单")
    private boolean lockUnion;

    @FieldTypeAnnotation(desc = "buff刷新时间")
    private long refreshTime;

    @FieldTypeAnnotation(desc = "城主ID")
    private long process2WinUserId;
    // 缓存
    private Map<Integer, Map<eSuiTangWarType, Map<Integer, Map<Integer, CrossSuiTangCityEvent>>>> cityEventMap = new ConcurrentHashMap<>(); // 阶段，战场、组No、城池ID、城池数据

    // 缓存
    private Map<Integer, Map<eSuiTangWarType, Map<Integer, Map<Integer, CrossSuiTangCity>>>> cityMap = new ConcurrentHashMap<>(); // 所有城池：阶段，战场、组No、城池ID、城池数据

    @FieldTypeAnnotation(desc = "当前分组信息", sqlType = Types.LONGVARCHAR)
    private Map<Integer, Map<eSuiTangWarType, Map<Integer, CrossSuiTangGroup>>> actGroupMap = new ConcurrentHashMap<>();  // 当前阶段分组信息 - <战场，<组No,组内信息>>

    // ===============================================

    public int getActivityId() {
        return activityId;
    }
    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getProcess2WinUserId() {
        return process2WinUserId;
    }

    public void setProcess2WinUserId(long process2WinUserId) {
        if (this.process2WinUserId != process2WinUserId) {
            this.process2WinUserId = process2WinUserId;
            setOp(DataStatus.Update);
        }
    }

    public int getGroupId() {
        return groupId;
    }
    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public AtomicInteger getBattleRound() {
        return battleRound;
    }
    public void setBattleRound(AtomicInteger battleRound) {
        if (null == battleRound){
            return;
        }
        if (this.battleRound == null || !this.battleRound.equals(battleRound)) {
            this.battleRound = battleRound;
            setOp(DataStatus.Update);
        }
    }

    public eSuiTangStage getStep() {
        return step;
    }
    public void setStep(eSuiTangStage step) {
        if (null == step){
            return;
        }
        if (this.step == null || !this.step.equals(step)) {
            this.step = step;
            setOp(DataStatus.Update);
        }
    }

    public long getRefreshTime() {
        return refreshTime;
    }

    public void setRefreshTime(long refreshTime) {
        if (this.refreshTime != refreshTime) {
            this.refreshTime = refreshTime;
            setOp(DataStatus.Update);
        }
    }

    public boolean getLockUnion() {
        return lockUnion;
    }
    public void setLockUnion(boolean lockUnion) {
        if (this.lockUnion != lockUnion) {
            this.lockUnion = lockUnion;
            setOp(DataStatus.Update);
        }
    }

    public Map<Integer, Map<eSuiTangWarType, Map<Integer, Map<Integer, CrossSuiTangCityEvent>>>> getCityEventMap() {
        return cityEventMap;
    }
    public void setCityEventMap(Map<Integer, Map<eSuiTangWarType, Map<Integer, Map<Integer, CrossSuiTangCityEvent>>>> cityEventMap) {
        if (null == cityEventMap){
            return;
        }
        if (this.cityEventMap == null || !this.cityEventMap.equals(cityEventMap)) {
            this.cityEventMap = cityEventMap;
        }
    }

    public Map<Integer, Map<eSuiTangWarType, Map<Integer, Map<Integer, CrossSuiTangCity>>>> getCityMap() {
        return cityMap;
    }
    public void setCityMap(Map<Integer, Map<eSuiTangWarType, Map<Integer, Map<Integer, CrossSuiTangCity>>>> cityMap) {
        if (null == cityMap){
            return;
        }
        if (this.cityMap == null || !this.cityMap.equals(cityMap)) {
            this.cityMap = cityMap;
        }
    }

    public java.util.Map<Integer, Map<eSuiTangWarType, java.util.Map<Integer, CrossSuiTangGroup>>> getActGroupMap() {
        return actGroupMap;
    }
    public void setActGroupMap(java.util.Map<Integer, Map<eSuiTangWarType, java.util.Map<Integer, CrossSuiTangGroup>>> actGroupMap) {
        if (null == actGroupMap){
            return;
        }
        if (this.actGroupMap == null || !this.actGroupMap.equals(actGroupMap)) {
            this.actGroupMap = actGroupMap;
            setOp(DataStatus.Update);
        }
    }
}
